package com.web.base.user.service;

import com.blue.jdbc.JdbcDataSource;
import com.blue.jdbc.Page;
import com.web.base.user.dao.BankCardDao;
import com.web.base.user.model.BankCard;
import com.web.core.util.Const;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 银行卡业务层
 * 
 * @author 代码由 blue-code 框架生成
 * @since 1.0 2018年06月26日
 */
@Service("userBankCardService")
@Transactional
@JdbcDataSource(Const.DS_BASE)
public class BankCardService
{
	@Autowired
	private BankCardDao bankCardDao;
	
	public BankCardService()
	{
	}
	
	public BankCard save(BankCard bankCard)
	{
		if (bankCard.getId() == null)
		{
			bankCardDao.save(bankCard);
		}
		else
		{
			bankCardDao.update(bankCard);
		}
		BankCard a = bankCardDao.get(bankCard.getId());
		return a;
	}
	
	public BankCard get(Integer id)
	{
		BankCard bankCard = bankCardDao.get(id);
		return bankCard;
	}
	
	public Page<BankCard> list(BankCard bankCard, Page<BankCard> page)
	{
		page = bankCardDao.list(bankCard, page);
		return page;
	}
	
	public List<BankCard> list(BankCard bankCard)
	{
		List<BankCard> list = bankCardDao.list(bankCard);
		return list;
	}
	
	public void delete(BankCard bankCard)
	{
		bankCardDao.delete(bankCard);
	}
	
}
